package com.lantosec.hmrp.modules.category.entity;

import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.category.vo.AssetsCategoryVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

/**
 * <p>
 * 资产类别表 实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-03-31
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AssetsCategory extends BaseEntity<AssetsCategoryVO> {

    private static final long serialVersionUID = 1L;
    public AssetsCategory(AssetsCategoryVO vo){
        this.categoryId = vo.getCategoryId();
        this.categoryName = vo.getCategoryName();
        this.parentId = vo.getParentId();
        this.leaf = vo.getLeaf();
        this.serviceLife = vo.getServiceLife();
        this.remark = vo.getRemark();
        this.categoryOrder = vo.getCategoryOrder();
    }

    @Override
    public AssetsCategoryVO convertToVO(){
        return new AssetsCategoryVO(this);
    }


    /**
     * 分类ID(3+3模式，自动生成)
     */
    @TableId(value = "category_id", type = IdType.ASSIGN_ID)
    private String categoryId;

    /**
     * 分类名称
     */
    private String categoryName;

    /**
     * 上级分类ID
     */
    private String parentId;

    /**
     * 是否末级(0否,1是)
     */
    private Boolean leaf;

    /**
     * 折旧年限(月)
     */
    private Integer serviceLife;

    /**
     * 说明
     */
    private String remark;

    /**
     * 排序
     */
    private Integer categoryOrder;


    public enum ColName {
        category_id, category_name, parent_id, leaf, service_life, remark, category_order, 
    }
}
